<template>
  <div class="info">
    <div style="margin: 20px"></div>
    <p>基本信息</p>
    <el-form
      :label-position="labelPosition"
      label-width="80px"
      :model="formLabelAlign"
    >
      <el-form-item label="头像">
        <el-avatar
          :src="this.formLabelAlign.photo"
          style="width: 200px; height: 200px"
        ></el-avatar>
      </el-form-item>
      <el-form-item label="用户名">
        <el-input
          style="width: 200px"
          v-model="this.formLabelAlign.username"
          disabled
        ></el-input>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input
          style="width: 200px"
          v-model="this.formLabelAlign.nickname"
          disabled
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import request from '@/api/request'
import decodedToken from '@/api/tokenDecode'

export default {
  name: 'ManagerInfo',

  data() {
    return {
      labelPosition: 'top',
      formLabelAlign: {
        username: decodedToken().claims.username,
        photo: '',
        nickname: '',
      },
    }
  },
  methods: {
    getAdminInfo() {
      request.get('/admin/adminInfo').then((res) => {
        this.formLabelAlign.photo = res.data.photo
        this.formLabelAlign.nickname = res.data.nickname
      })
    },
  },
  mounted() {
    this.getAdminInfo()
  },
}
</script>

<style scoped>
.info {
  margin: 40px;
}
</style>
